package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.UserLevel;
import com.micro.modual.model.bo.userlevel.UserLevelBO;

import java.util.Date;

/**
 * <h1>用户等级表 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class UserLevelExtension {

    /**
     * <h2>转换: 用户等级表 新增</h2>
     *
     * @param userLevelBO {@link UserLevelBO} 用户等级表 新增/修改 请求对象
     * @return {@link UserLevel} 用户等级表
     */
    public static UserLevel converAddUserLevel(UserLevelBO userLevelBO) {
        UserLevel userLevel = new UserLevel();
        userLevel.setId(SnowFlakeUtil.getId());
        userLevel.setLevelName(userLevelBO.getLevelName());
        userLevel.setGrowthPoint(userLevelBO.getGrowthPoint());
        userLevel.setIsDefaultLevel(userLevelBO.getIsDefaultLevel());
        userLevel.setFreeFreightPoint(userLevelBO.getFreeFreightPoint());
        userLevel.setCommentGrowthPoint(userLevelBO.getCommentGrowthPoint());
        userLevel.setPriviledgeFreeFreight(userLevelBO.getPriviledgeFreeFreight());
        userLevel.setPriviledgeMemberPrice(userLevelBO.getPriviledgeMemberPrice());
        userLevel.setPriviledgeBirthday(userLevelBO.getPriviledgeBirthday());
        userLevel.setNote(userLevelBO.getNote());
        userLevel.setCreateTime(new Date());
        return userLevel;
    }

    /**
     * <h2>转换: 用户等级表 修改</h2>
     *
     * @param userLevelBO {@link UserLevelBO} 用户等级表 新增/修改 请求对象
     * @return {@link UserLevel} 用户等级表
     */
    public static UserLevel converEditUserLevel(UserLevelBO userLevelBO) {
        UserLevel userLevel = new UserLevel();
        userLevel.setId(userLevelBO.getId());
        userLevel.setLevelName(userLevelBO.getLevelName());
        userLevel.setGrowthPoint(userLevelBO.getGrowthPoint());
        userLevel.setIsDefaultLevel(userLevelBO.getIsDefaultLevel());
        userLevel.setFreeFreightPoint(userLevelBO.getFreeFreightPoint());
        userLevel.setCommentGrowthPoint(userLevelBO.getCommentGrowthPoint());
        userLevel.setPriviledgeFreeFreight(userLevelBO.getPriviledgeFreeFreight());
        userLevel.setPriviledgeMemberPrice(userLevelBO.getPriviledgeMemberPrice());
        userLevel.setPriviledgeBirthday(userLevelBO.getPriviledgeBirthday());
        userLevel.setNote(userLevelBO.getNote());
        userLevel.setUpdateTime(new Date());
        return userLevel;
    }
}
